<template>
  <div>
    <el-table
      :data="tableData"
      height="250"
      border
      style="width: 100%">
      <el-table-column
        prop="jid"
        label="jid"
        width="180">
      </el-table-column>
      <el-table-column
        prop="authority"
        label="权限">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
    export default {
      name: "UserProFile",
      props: ['id','name'],
      data() {
        return {
          info:{
            authority : null,
            jid : null
          },
          /*tableData: [{
            id: {{name}},
            name: {{id}},
          }]*/
          /*tableData: [{
            jid: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
          }, {
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
          }]*/
        }
      },
      beforeRouteEnter: (to,from,next) => {
        console.log('进入路由之前');//加载数据
        next(vm => {
          vm.getData();//进入路由之前执行getData()
        })
      },
      /*mounted:function(){
        this.tableData[]
      },*/
      beforeRouteLeave: (to,from,next) => {
        console.log('进入路由之后');
        next()
      },
      methods: {
        getData:function() {
          /*this.axios({
            method: 'get',
            url: 'http://evidence.frogking.cn/userController/selectByUid?token=Rp6npIeiQ93mSFpsmeg7gA=='
          }).then(response=>(console.log(response)));*/
          this.axios({
            method:"post",
            headers: { 'content-type': 'application/json' },
            url: "http://evidence.frogking.cn/userController/selectByUid",
            params:{
              token: 'Rp6npIeiQ93mSFpsmeg7gA=='
            }
          }).then(res=>{
            this.info=res["data"]["item"];
            console.log(res["data"]["item"]);

          }).catch(function (error) {
            console.log(error);
          })
        }
      }
    }
</script>

<style scoped>

</style>
